package com.niit.order.web;

import com.niit.feign.clients.UserClient;
import com.niit.feign.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 使用Feign-api模块进行演示
 *
 * @author yaojianfeng
 */

@RestController
@RequestMapping("/feign/api")
public class FeignConsumerController {

    @Autowired
    private UserClient userClient;


    @GetMapping("/order/request")
    public String requestParamDemo(@RequestParam String param) {
        return userClient.requestParam(param);
    }

    @GetMapping("/order/header")
    public User headerInfo(@RequestHeader String name, @RequestHeader String address) {
        return userClient.headerInfo(name, address);
    }

    @GetMapping("/order/body")
    public String bodyInfo(@RequestBody User user) {
        return userClient.bodyInfo(user);
    }
}
